# BASE LIST
# -----------------------------------------------------------------------------
# This serves as the base for all lists.

class BaseList

    id: 0

    # Holds the URL used to load and save data. Loading will use a GET request,
    # and saving will use a POST request.
    url: null

    # Holds the date of the last succesful save call on the server.
    lastSave: null

    # Holds the date of the last succesful load call on the server.
    lastLoad: null

    # Object which holds all the models.
    models: new Array()


    # ADDING AND REMOVING
    # -------------------------------------------------------------------------

    # Add a single model to the list.
    add: (model, bypassDuplicateCheck) =>
        if bypassDuplicateCheck
            @models.push add

    # Remove the specified model from the list.
    remove: (model) =>
        for item in @models
            if item.id is model.id
                @models.splice item


    # SERVER SYNC
    # -------------------------------------------------------------------------

    # Save the model to the server.
    save: =>
        alert 4

    # Load the model's data and attributes from the server.
    load: =>
        alert 5

# Module exports (only necessary on the server side).
if exports?
    module.exports = BaseList
else
    window.App.BaseList = BaseList